package com.chj.chap05.oom;

/**
 * VM Args: -Xss128k
 * 栈溢出:  1M *5000线程同时在跑 =5G 内存小于5G
 */
public class StackOverFlow {
    private int stackLength = 1;
    public void stackLeak(){
        stackLength++;
        stackLeak(); // 死递归
    }
    public static void main(String[] args)throws Throwable {
        StackOverFlow javaStack = new StackOverFlow();
        javaStack.stackLeak();
        System.out.println("stack length: "+ javaStack.stackLength);
    }
}
